package com.xxxy.model;

import java.io.Serializable;
import java.util.List;

public class PageResult<T> implements Serializable {
    private int code;
    private String msg;
    private int count;
    private List<T> data;

    public PageResult() {
        super();
    }

    public PageResult(int code, String msg, int count, List<T> data) {
        super();
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public PageResult(List<T> data, long total, int pageNum, int pageSize) {
        this.code = 0;
        this.msg = "";
        this.count = (int) total; // long转int（需考虑数据范围）
        this.data = data;
    }

    public PageResult(List data, int total, int pageNum, int pageSize) {
        this.code = 0;
        this.msg = "";
        this.count = total;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}
